package com.javastudy.autowiredStudy.springconverter;

import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 全局拦截器
 * @author mac
 * @date 2021/9/7 3:33 下午
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    /**
     * 将日期转换器注册到全局拦截器当中
     * @param registry
     */
    @Override
    public void addFormatters(FormatterRegistry registry) {
        registry.addConverter(new DateConverter());
    }
}
